#pragma once
#include"AbstractLayer.h"

class DemoMouseJoint : public AbstractLayer
{
public:
	createScene(DemoMouseJoint)

    CREATE_FUNC(DemoMouseJoint)

	bool init();

	void box2DAppReady() override;
	
	void createBodies();

	void createMouseJoint(b2Vec2 anchorB);

	virtual bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *unused_event) override;

	virtual void onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *unused_event) override;
private:
	b2Body * embd;
	b2MouseJoint * mouseJoint;
	b2Vec2 mousePoint;
	b2Body* player;
};
